const App = getApp()
Page({
	data: {
        loading: true,
        face_show:true,
        face: App.path.img.face,
        img: App.path.img.certification.tip,
        img_ok: App.path.img.certification.ok,
        img_cancel: App.path.img.certification.cancel,
        img_back: App.path.img.certification.back,
        certification_status:false
    },
    onLoad: function () {
        this.InitPagre();
    },
    InitPagre() {
        this.checkCertification();
        this.smile();
    },
    checkCertification(){
        App.Api.ajax.getCheckCertification();
        let status= App.Api.certification.status()
        if (status){
            this.setData({
                certification_status: status
            })
            if(status=="apply"){
                this.setData({
                    img: App.path.img.certification.apply
                })
            }
        }
    },
    gotoPage(e) {
        let pageName = e.currentTarget.dataset.pageName;
        App.Api.gotoPage(pageName);
    },
    smile(){
        let _ = this;
        App.Api.delay(1000).then(()=>{
            _.changeSmile()
            return App.Api.delay(500)
        }).then(() => {
            _.changeSmile()
            return App.Api.delay(1000)
        }).then(() => {
            _.setData({
                loading: false
            })
        })
    },
    changeSmile(){
        this.setData({
            face_show: !this.data.face_show
        })
    },
    cancel(){
        App.Api.certification.cancel()
    }
})